package com.xzc._2_deploy;

import org.kie.api.KieBase;
import org.kie.api.KieBaseConfiguration;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;

/**
 * 使用自定义的classloader来加载KieBase，一般用在OSGI中
 */
public class UseYouselfClassLoader {

    public void normal() {
        KieServices kieServices = KieServices.Factory.get();
        KieBaseConfiguration kbaseConf = kieServices.newKieBaseConfiguration(null, UseYouselfClassLoader.class.getClassLoader());
        ReleaseId releaseId = kieServices.newReleaseId("org.acme", "myartifact", "1.0");
        KieContainer kieContainer = kieServices.newKieContainer(releaseId);
        KieBase kbase = kieContainer.newKieBase(kbaseConf);
    }
}
